from rest_framework_simplejwt.views import TokenRefreshView,TokenObtainPairView
from django.urls import path
from .views.home import DailyActiveAPIView,DailyOrderCountAPIView,MonthCountAPIView,MonthOrderCountAPIView
from apps.meiduo_admin.views import user,images,sku,permission
from apps.meiduo_admin.user import meiduo_token
urlpatterns = [
    path('authorizations/',meiduo_token),    
    path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    # 日活统计
    path('statistical/day_active/',DailyActiveAPIView.as_view()),
     # 日下单用户
    path('statistical/day_orders/',DailyOrderCountAPIView.as_view()),
    # 月增用户趋势图
    path('statistical/month_increment/',MonthCountAPIView.as_view()),
     # 月下单用户趋势图
    path('statistical/goods_day_views/',MonthOrderCountAPIView.as_view()),
    # user
    path('users/',user.UserAPIView.as_view()),
     # 获取图片新增中的 sku展示
    path('skus/simple/',images.ImageSKUView.as_view()),
    # 获取图片新增中的 sku展示
    path('skus/categories/',sku.GoodsCategoryAPIView.as_view()),
    # spu数据
    path('goods/simple/',sku.SPULIstAPIView.as_view()),
    # spu 规格和规格选项 数据
    path('goods/<int:spu_id>/specs/',sku.SPUSpecAPIView.as_view()),

    #权限中 获取 ContentType 的数据
    path('permission/content_types/', permission.ContentTypeListAPIView.as_view()),

    
]

from rest_framework.routers import DefaultRouter
#  1.创建router实例
router=DefaultRouter()
# 2. 设置路由
router.register('skus/images',images.ImageModelViewSet,basename='images')


################sku#############################
router.register('skus',sku.SKUModelViewSet,basename='skus')


################权限#############################
router.register('permission/perms',permission.PermissionModelViewset,basename='perms')


###############组##################################
router.register('permission/groups',permission.GroupModelViewSet,basename='groups')
# 3. 将路由添加到urlpatterns中
urlpatterns += router.urls
